//
//  HTComponseViewController.swift
//  WeiBoDemo
//
//  Created by 郝涛 on 16/4/23.
//  Copyright © 2016年 郝涛. All rights reserved.
//

import UIKit

class HTComponseViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        setupUI()
    }
    //设置控件
    func setupUI(){
       view.backgroundColor = UIColor.whiteColor()
        //设置导航栏
        setupNav()
    }
    
    func setupNav(){
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "取消", style: UIBarButtonItemStyle.Plain, target: self, action: "cencel")
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "发送", style: UIBarButtonItemStyle.Plain, target: self, action: "send")
        
        navigationItem.titleView = titleView
    }
    //懒加载控件
    lazy var titleView:UILabel = {
       //获取用户名字
        let  name = HTUserAccountTools.sharedTools.UserInfoModel!.screen_name!
        
        //发微博
        let titleString = "发微博\n\(name)"
        //富文本
        let attr = NSMutableAttributedString(string: titleString)
        
        //获取range
        let range = (titleString as NSString).rangeOfString(name)
        //设置指定位置的颜色和字体大小
        attr.addAttribute(NSForegroundColorAttributeName,value:UIColor.orangeColor(),range: range)
        attr.addAttribute(NSFontAttributeName,value:UIFont.systemFontOfSize(14),range: range)
        
        let lab = UILabel ()
        
        lab.attributedText = attr
        
        lab.textColor = UIColor.orangeColor()
        
        //lab.font = UIFont.systemFontOfSize(14)
        
        lab.textAlignment = .Center
        
        lab.numberOfLines = 0
        
        lab.sizeToFit()
        return lab

    }()
    
    //文本输入框
    private lazy var componseTextView
    
}
